package reader.module.show;

import javax.microedition.lcdui.Canvas;
import javax.microedition.lcdui.Graphics;

import reader.module.buffer.*;

public class ContentCanvas extends Canvas {
	private BufferManager manager = new BufferManager();
	private ContentView view = new ContentView(manager, getWidth(), getHeight());

	public void paint(Graphics g) {
		g.setColor(0xFFFFFF);
		g.fillRect(0, 0, getWidth(), getHeight());
		g.setColor(0x000000);

		view.draw(g);
	}

	public void keyPressed(int keyCode) {
		int action = getGameAction(keyCode);
		switch (action) {
		case UP:
			view.adjust(ContentView.UP);
			break;
		case DOWN:
			view.adjust(ContentView.DOWN);
			break;
		default:
			break;
		}
		repaint();
	}
}
